<template>
    <div>
        <div  class="qrcode" ref="qrCodeUrl"></div>
    </div>
</template>
<script>
import QRCode from'qrcodejs2'
export default {
    
    props:['code'],
   data() {
      return {
      }
   },
   mounted(){
    this.creatQrCode()
   },
   updated(){
    this.creatQrCode()
   },
   methods:{
    creatQrCode() {
            var qrcode = new QRCode(this.$refs.qrCodeUrl, {
                text: `${this.code}`, // 需要转换为二维码的内容
                width: 140,
                height: 140,
                colorDark: '#000000',
                colorLight: '#ffffff',
                correctLevel: QRCode.CorrectLevel.H
            })
        },

   },
}
</script>
<style  scoped>
.qrcode {
    display: inline-block;
    background-color: #fff;
    padding: 40rem;
    box-sizing: border-box;
}
</style>
